/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.bld.model.anuncio;

import br.com.bld.util.facade.BLDDataErro;
import java.io.File;
import java.util.Date;

/**
 *
 * @author Pedro
 */
public class AnuncioEntity implements BLDDataErro {

    public static final String CLASS_ID = "AnuncioEntity";

    private Date dataInicio;        // date NOT NULL,
    private Date dataFim;           // date NOT NULL,
    private String imageName;       // character varying(255)
    private File image;             // bytea
    private Long planoId;           // integer NOT NULL

    public static final String CAMPO_DATA_INICIO = "Data Início";
    public static final String CAMPO_DATA_FIM = "Data Fim";
    public static final String CAMPO_IMAGE_NAME = "Imagem name";
    public static final String CAMPO_IMAGE = "Imagem";
    public static final String CAMPO_PLANO_ID = "Plano ID";

    /**
     * @return the dataInicio
     */
    public Date getDataInicio() {
        return dataInicio;
    }

    /**
     * @param dataInicio the dataInicio to set
     */
    public void setDataInicio(Date dataInicio) {

        if (dataInicio == null) {
            throw new IllegalArgumentException(String.format(CAMPO_OBRIGATORIO, CAMPO_DATA_INICIO));
        }

        this.dataInicio = dataInicio;
    }

    /**
     * @return the dataFim
     */
    public Date getDataFim() {
        return dataFim;
    }

    /**
     * @param dataFim the dataFim to set
     */
    public void setDataFim(Date dataFim) {

        if (dataFim == null) {
            throw new IllegalArgumentException(String.format(CAMPO_OBRIGATORIO, CAMPO_DATA_FIM));
        }

        this.dataFim = dataFim;
    }

    /**
     * @return the planoId
     */
    public Long getPlanoId() {
        return planoId;
    }

    /**
     * @param planoId the planoId to set
     */
    public void setPlanoId(Long planoId) {

        if (planoId == null) {
            throw new IllegalArgumentException(String.format(CAMPO_OBRIGATORIO, CLASS_ID));
        }

        if (planoId <= 0) {
            throw new IllegalArgumentException(VALOR_NAO_PERMITIDO);
        }

        this.planoId = planoId;
    }

    /**
     * @return the imageName
     */
    public String getImageName() {
        return imageName;
    }

    /**
     * @param imageName the imageName to set
     */
    public void setImageName(String imageName) {
        this.imageName = imageName;
    }

    /**
     * @return the image
     */
    public File getImage() {
        return image;
    }

    /**
     * @param image the image to set
     */
    public void setImage(File image) {
        this.image = image;
    }
}
